<template>
  <div class="project-management-container">
    <div class="project-header">
      <h2>项目管理表格</h2>
    </div>

    <div class="form-section">
      <!-- 第一行 -->
      <div class="form-row">
        <div class="form-group">
          <label>专项名称</label>
          <input type="text" v-model="project.specialName" class="form-control">
        </div>
        <div class="form-group">
          <label>项目1</label>
          <input type="text" v-model="project.project1" class="form-control" value="项目1">
        </div>
        <div class="form-group">
          <label>项目编号</label>
          <input type="text" v-model="project.projectCode" class="form-control">
        </div>
      </div>

      <!-- 第二行 -->
      <div class="form-row">
        <div class="form-group">
          <label>主责人</label>
          <input type="text" v-model="project.principal" class="form-control" value="张三">
        </div>
        <div class="form-group">
          <label>状态</label>
          <select v-model="project.status" class="form-control">
            <option value="">请选择状态</option>
            <option value="processing">进行中</option>
            <option value="completed">已完成</option>
            <option value="canceled">已取消</option>
          </select>
        </div>
        <div class="form-group">
          <label>下拉菜单</label>
          <select v-model="project.dropdown" class="form-control">
            <option value="">请选择</option>
            <option value="option1">选项1</option>
            <option value="option2">选项2</option>
          </select>
        </div>
      </div>

      <!-- 改善类型行 -->
      <div class="form-row">
        <div class="form-group">
          <label>改善类型</label>
          <select v-model="project.improvementType" class="form-control">
            <option value="S">S级</option>
            <option value="A">A级</option>
            <option value="B">B级</option>
          </select>
        </div>
        <div class="form-group">
          <label>专项状态</label>
          <select v-model="project.specialStatus" class="form-control">
            <option value="S">S级</option>
            <option value="A">A级</option>
            <option value="B">B级</option>
          </select>
        </div>
        <div class="form-group">
          <label>立项日期</label>
          <input type="datetime-local" v-model="project.startDate" class="form-control">
        </div>
      </div>

      <!-- 激励信息行 -->
      <div class="form-row">
        <div class="form-group">
          <label>激励申请</label>
          <input type="number" v-model="project.incentiveApply" class="form-control" value="100">
        </div>
        <div class="form-group">
          <label>项目奖励</label>
          <input type="number" v-model="project.projectReward" class="form-control" value="100">
        </div>
        <div class="form-group">
          <label>实发奖励</label>
          <input type="number" v-model="project.actualReward" class="form-control" value="100">
        </div>
      </div>

      <!-- 结项日期 -->
      <div class="form-row">
        <div class="form-group">
          <label>结项日期</label>
          <input type="datetime-local" v-model="project.endDate" class="form-control">
        </div>
      </div>

      <!-- 团队成员 -->
      <div class="form-group full-width">
        <label>团队成员</label>
        <textarea v-model="project.teamMembers" class="form-control" rows="2"></textarea>
      </div>

      <!-- 改善背景 -->
      <div class="form-group full-width">
        <label>改善背景</label>
        <textarea v-model="project.improvementBackground" class="form-control" rows="3"></textarea>
      </div>

      <!-- 改善目标 -->
      <div class="form-group full-width">
        <label>改善目标</label>
        <textarea v-model="project.improvementGoal" class="form-control" rows="3"></textarea>
      </div>

      <!-- 改善方案 -->
      <div class="form-group full-width">
        <label>改善方案</label>
        <textarea v-model="project.improvementPlan" class="form-control" rows="3"></textarea>
      </div>

      <!-- 项目达成 -->
      <div class="form-group full-width">
        <label>项目达成</label>
        <textarea v-model="project.projectAchievement" class="form-control" rows="3"></textarea>
      </div>

      <!-- 操作按钮 -->
      <div class="form-actions">
        <button class="btn btn-primary" @click="submitForm">提交</button>
        <button class="btn btn-secondary" @click="resetForm">重置</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      project: {
        specialName: '',
        project1: '项目1',
        projectCode: '',
        principal: '张三',
        status: '',
        dropdown: '',
        improvementType: 'S',
        specialStatus: 'S',
        startDate: '2025-01-12T00:00',
        incentiveApply: 100,
        projectReward: 100,
        actualReward: 100,
        endDate: '2025-12-12T00:00',
        teamMembers: '',
        improvementBackground: '',
        improvementGoal: '',
        improvementPlan: '',
        projectAchievement: ''
      }
    }
  },
  methods: {
    submitForm() {
      alert('提交成功！');
      console.log('提交数据:', this.project);
    },
    resetForm() {
      this.project = {
        specialName: '',
        project1: '项目1',
        projectCode: '',
        principal: '张三',
        status: '',
        dropdown: '',
        improvementType: 'S',
        specialStatus: 'S',
        startDate: '2025-01-12T00:00',
        incentiveApply: 100,
        projectReward: 100,
        actualReward: 100,
        endDate: '2025-12-12T00:00',
        teamMembers: '',
        improvementBackground: '',
        improvementGoal: '',
        improvementPlan: '',
        projectAchievement: ''
      };
      alert('表单已重置！');
    }
  }
}
</script>

<style scoped>
.project-management-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: Arial, sans-serif;
}

.project-header {
  margin-bottom: 20px;
  text-align: center;
}

.form-section {
  background: #fff;
  padding: 20px;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 15px;
  gap: 15px;
}

.form-group {
  flex: 1;
  min-width: 200px;
}

.form-group.full-width {
  flex: 0 0 100%;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

textarea.form-control {
  min-height: 80px;
}

.form-actions {
  margin-top: 20px;
  text-align: right;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary {
  background-color: #409eff;
  color: white;
}

.btn-secondary {
  background-color: #f4f4f5;
  color: #606266;
  margin-left: 10px;
}

.btn-primary:hover {
  background-color: #66b1ff;
}

.btn-secondary:hover {
  background-color: #e9e9eb;
}
</style>